<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var obj = {
      '2': 'a',
      '3': 'b',
      length: 2,
      push: Array.prototype.push
    }
    obj.push('c')
    obj.push('d')
    // obj --> {'2':'a','3':'c','4':'d',length:4,push:Array.prototype.push} 错误
    // 关键点在length上，push的原理(假设只有一个参数的情况)如下 
    Array.prototype.push = function (target) {
      this[this.length] = target;
      this.length++;
    }
  </script>
</body>

</html>